from selenium.webdriver import ActionChains

from Keyword import Keyword

web=Keyword()
web.openBrower()
web.visiturl('https://kyfw.12306.cn/otn/resources/login.html')
#登录操作
web.input('//*[@id="J-userName"]',"18319186054")
web.input('//*[@id="J-password"]',"5732486angel")
web.click('//*[@id="J-login"]')
web.sleep('1')
# web.draw_and_drop('//*[@id="nc_1_n1z"]','//*[@id="nc_1__scale_text"]')

#
ele1=web.findelement('//*[@id="nc_1_n1z"]')
small_width=ele1.size.get('width')
ele2=web.findelement('//*[@id="nc_1__scale_text"]')
large_width=ele2.size.get('width')
offset_value=large_width-small_width
print(offset_value)
ActionChains(web.driver).drag_and_drop_by_offset(ele1, offset_value, 0).perform()

